package HomeWork.Work_02;

import java.util.Scanner;

/**
 * 编写一个程序，求整数n的阶乘，例如5的阶乘是1*2*3*4*5。
 */
public class Factorial {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字");
        int n = sc.nextInt();
        String x = factorial(n);
        System.out.println(x);
    }
    public static String factorial(int n){
        String a = "";
        for(int i = 0; i <= n; i++){
            if(0 == i){
                a = "1";
            }else if(1 == i){
                a = "1*";
            }else if(i == n){
                a = a + i;
            }else{
                a = a + i + "*";
            }
        }
        return a;
    }
}
